﻿$ExecutePath = $PWD
Set-Location $PSScriptRoot

Set-Location ..

# 判断是否下载了Node.js扩展包
if (!(Test-Path "./node_modules")) {
    Write-Host "npm i"
    npm i
}

## Scss 编译
# =================================================================================================================== #
## 清理
function remove_generate_files {
    param (
        [string[]]$files
    )
    for ($i = 0; $i -lt $files.Count; $i++) {
        if ($files.Count -eq 1) {
            $item = $files;
        } else {
            $item = $files[$i]
        }
        $item = $item -replace "\\","/"
        Write-Host "Remove-Item $item"
        Remove-Item $item
    }
}
remove_generate_files(Get-ChildItem -Recurse -Include *.s.css -Name)
remove_generate_files(Get-ChildItem -Recurse -Include *.s.css.map -Name)

Set-Location $ExecutePath
if ($PSScriptRoot -eq $ExecutePath) {
    # timeout.exe /T -1
}
